<?php
class BonusDeck{
	private $m_cards = array();
	private $m_dealtCards;
	private $m_totalCardsAtShuffle;

	function __construct()
	{
		
	}
	static function CopyCardList()
	{
		$self::$bonusCardList = new BonusDeck();
	}
	
	function Shuffle()
	{
		$this->m_totalCardsAtShuffle = count($this->m_cards);
		$this->m_dealtCards = 0;
		if(count($this->m_cards) > 1)
		{
			shuffle($this->m_cards);
		}
	}
	function DealCard($a_robot)
	{
		if(count($this->m_cards) > 0)
		{
			$card = $this->m_cards[$this->m_dealtCards];
			$a_robot->GiveCard($card);
			$this->m_dealtCards++;
		}
		else
		{
			return "Det finns inte några kort i kortleken";
		}
	}
	function CollectCard($a_bonusCard)
	{
		$a_bonusCard->setOwner(null);
		//skapar en temporär array 
		$arr = array();
		for ($i=0; $i < count($this->m_cards); $i++) { 
			$arr[$i] = $this->m_cards[$i];
		}
		$this->m_cards = array();
		for ($i=0; $i < count($arr); $i++) { 
			if ($arr[$i]->GetID() != $a_bonusCard->GetID()) {
				array_push($this->m_cards, $arr[$i]);
			}
		}
		array_push($this->m_cards, $a_bonusCard);
	}
	//function SwapCard($firstCard, $secondCard){}
}
